/*
    Copyright (C) 2012  Collombet

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    */

#ifndef OBJECT_H
#define OBJECT_H

#include <stdlib.h>
#include <stdio.h>

struct s_Object
{
    void (*toString)(const void* value, int fd);
    int (*equals)(const void* value, const void* operande);
    int (*copy)(const void* value, void* ret);
    int (*create)(void** value, void* args);
    int (*initialize)(void* value, void* args);
    void (*clear)(void* value);
    void (*destroy)(void** value);
} typedef Object;

void object_create(Object** value,
                   void (*toString)(const void* value, int fd),
                   int (*equals)(const void* value, const void* operande),
                   int (*copy)(const void* value, void* ret),
                   int (*create)(void** value, void* args),
                   int (*initialize)(void* value, void* args),
                   void (*clear)(void* value),
                   void (*destroy)(void** value));

void object_initialize(Object* value,
                       void (*toString)(const void* value, int fd),
                       int (*equals)(const void* value, const void* operande),
                       int (*copy)(const void* value, void* ret),
                       int (*create)(void** value, void* args),
                       int (*initialize)(void* value, void* args),
                       void (*clear)(void* value),
                       void (*destroy)(void** value));
void object_copy(const Object* value, Object* ret);
void object_clear(Object* value);
void object_destroy(Object** value);
int object_equals(const void* value, const void* operande);
void object_toString(const void* value, int fd);

/*Object*/

Object _object_Object;
Object object_getObject();

/*Object*/

Object object_getObject();
int _object_copy(const void* value, void* ret);
int _object_create(void** value, void* args);
int _object_initialize(void* value, void* args);
void _object_destroy(void** value);
void _object_clear(void* value);

/*int*/

Object _object_int;

const Object object_getInt();
void _int_toString(const void* value, int fd);
int _int_equals(const void* value, const void* operande);
int _int_copy(const void* value, void* ret);
int _int_create(void** value, void* args);
int _int_initialize(void* value, void* args);
void _int_destroy(void** value);
void _int_clear(void* value);

/*double*/

Object _object_double;

Object object_getDouble();
void _double_toString(const void* value, int fd);
int _double_equals(const void* value, const void* operande);
int _double_copy(const void* value, void* ret);
int _double_create(void** value, void* args);
int _double_initialize(void* value, void* args);
void _double_destroy(void** value);
void _double_clear(void* value);

/*float*/

Object _object_float;

Object object_getFloat();
void _float_toString(const void* value, int fd);
int _float_equals(const void* value, const void* operande);
int _float_copy(const void* value, void* ret);
int _float_create(void** value, void* args);
int _float_initialize(void* value, void* args);
void _float_destroy(void** value);
void _float_clear(void* value);

/*long*/

Object _object_long;

Object object_getLong();
void _long_toString(const void* value, int fd);
int _long_equals(const void* value, const void* operande);
int _long_copy(const void* value, void* ret);
int _long_create(void** value, void* args);
int _long_initialize(void* value, void* args);
void _long_destroy(void** value);
void _long_clear(void* value);

/*short*/

Object _object_short;

Object object_getShort();
void _short_toString(const void* value, int fd);
int _short_equals(const void* value, const void* operande);
int _short_copy(const void* value, void* ret);
int _short_create(void** value, void* args);
int _short_initialize(void* value, void* args);
void _short_destroy(void** value);
void _short_clear(void* value);

/*char*/

Object _object_char;

Object object_getChar();
void _char_toString(const void* value, int fd);
int _char_equals(const void* value, const void* operande);
int _char_copy(const void* value, void* ret);
int _char_create(void** value, void* args);
int _char_initialize(void* value, void* args);
void _char_destroy(void** value);
void _char_clear(void* value);

#endif /* OBJECT_H */
